package books;

/**
 * @Author MDD
 * @Description
 * @Version
 * @Date
 **/
public class Book {
    private String title;//书名
    private int pages;//页数

    public Book(String title,int pages) {
        this.title = title;
        setPages(pages);
    }

    public void details(){
        System.out.println("书名："+this.title+"\n总页数："+this.pages);
    }
    public String getTitle() {
        return this.title;
    }

    public void setTitle(final String title) {
        this.title = title;
    }

    public int getPages() {
        return this.pages;
    }

    public void setPages(int pages) {
        if (pages<200){
            this.pages = 200;
            System.err.println("图书不能小于200页");
        }else {
            this.pages = pages;
        }
    }

    public static void main(String[] args) {
        Book book = new Book("天威",300);
        book.details();;
    }
}
